var Page = {};
Page.init = function()
{
  Ext.QuickTips.init();
  Ext.form.Field.prototype.msgTarget = "side";
  //Ext.get("login-form-box").boxWrap();
  var loginForm = new Ext.form.BasicForm( Ext.select('form_login'),
    {
      method: "post",
      labelWidth: 48,
      buttonAlign: "left",
      url: "/sucri",
      baseParams: {action: "login"},
      labelSeperator:"",
      labelAlign: "top",
      buttonAlign: "left",
      waitMsgTarget : true
    }
  );
  loginForm.on("actioncomplete", function(t, a)
  {
    window.location.replace("/sucri?action=userinfo");
  });
  loginForm.on("actionfailed", function()
  {
    Ext.MessageBox.alert("Login Failure!", "Incorrect username or password. You may try again, but be aware that all login attempts are logged and monitored.");
  });
  loginForm.render("login-form");
};

Ext.onReady(Page.init, Page, true);